<%
var containerParam = {
	title: '从者素材管理',
	currentMenu: 'servantMgr',
	jsArray: [ctxPath + '/js/servant/item.js'],
	breadcrumbMap: {
		'首页': ctxPath + '/',
		'从者管理': ctxPath + '/servant/list',
		'从者素材管理': null
	}
};
layout('/common/_website_container.html', containerParam){
%>
<div class="layui-card">
	<div class="layui-card-body padding-15">
		<form class="layui-form" lay-filter="form">
			<#formhidden name="servantId" value="${parameter.id}"/>
			<% for (var i in range(1, 5)) { %>
			<#formdynamic label="再临阶段${i}" name="stage${i}" data="${servantMap[@ServantItemType.STAGE][i]}"/>
			<% } %>
			<% for (var i in range(2, 11)) { %>
			<#formdynamic label="lv.${i-1}→lv.${i}" name="skill${i}" data="${servantMap[@ServantItemType.SKILL][i]}"/>
			<% } %>
			<#formsubmit/>
		</form>
	</div>
</div>

<% for (var i in range(1, 5)) { %>
<script id="stage${i}Tpl" type="text/html">
	<div class="layui-row">
		<input type="hidden" name="ids" value="{{=d.id}}">
		<input type="hidden" name="types" value="${@ServantItemType.STAGE.getValue()}">
		<input type="hidden" name="levels" value="${i}">
		<div class="layui-input-inline">
			<select name="itemIds" lay-verify="required" lay-search>
				<option value=""></option>
				<% for (item in stageItems) { %>
				<option value="${item.id}" {{# if (d.itemId === ${item.id}) { }}selected{{# } }}>${item.name}</option>
				<% } %>
			</select>
		</div>
		<div class="layui-input-inline">
			<input type="text" class="layui-input" name="numbers" placeholder="数量" value="{{=d.number}}" lay-verify="required|number">
		</div>
		<a href="javascript:void(0)" class="layui-icon layui-icon-close delete-btn"></a>
	</div>
</script>
<% } %>
<% for (var i in range(2, 11)) { %>
<script id="skill${i}Tpl" type="text/html">
	<div class="layui-row">
		<input type="hidden" name="ids" value="{{=d.id}}">
		<input type="hidden" name="types" value="${@ServantItemType.SKILL.getValue()}">
		<input type="hidden" name="levels" value="${i}">
		<div class="layui-input-inline">
			<select name="itemIds" lay-verify="required" lay-search>
				<option value=""></option>
				<% for (item in skillItems) { %>
				<option value="${item.id}" {{# if (d.itemId === ${item.id}) { }}selected{{# } }}>${item.name}</option>
				<% } %>
			</select>
		</div>
		<div class="layui-input-inline">
			<input type="text" class="layui-input" name="numbers" placeholder="数量" value="{{=d.number}}" lay-verify="required|number">
		</div>
		<a href="javascript:void(0)" class="layui-icon layui-icon-close delete-btn"></a>
	</div>
</script>
<% } %>
<% } %>
